-
Notifications
You must be signed in to change notification settings - Fork 0
/
Propiedad:_x^2I1→xI1∨xI-1.lean
94 lines (87 loc) · 2.07 KB
/
Propiedad:_x^2I1→xI1∨xI-1.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
-- Propiedad: ∀ x : ℝ, x^2 = 1 → x = 1 ∨ x = -1
-- ============================================
import data.real.basic
variables (x : ℝ)
-- -----------------------------------------------------
-- Ejercicio 1. Demostrar que si
-- x^2 = 1
-- entonces
-- x = 1 ∨ x = -1
-- -----------------------------------------------------
-- 1ª demostración
example
(h : x^2 = 1)
: x = 1 ∨ x = -1 :=
begin
have h1 : (x - 1) * (x + 1) = 0,
calc (x - 1) * (x + 1)
= x^2 - 1 : by ring
... = 1 - 1 : by rw h
... = 0 : by ring,
have h2 : x - 1 = 0 ∨ x + 1 = 0,
{ -- by suggest,
exact mul_eq_zero.mp h1 },
cases h2 with h2a h2b,
{ left,
-- by suggest,
exact sub_eq_zero.mp h2a, },
{ right,
-- by library_search,
exact eq_neg_of_add_eq_zero h2b, },
end
-- 2ª demostración
example
(h : x^2 = 1)
: x = 1 ∨ x = -1 :=
begin
have h1 : (x - 1) * (x + 1) = 0,
linarith,
have h2 : x - 1 = 0 ∨ x + 1 = 0,
finish,
cases h2 with h2a h2b,
{ left,
linarith, },
{ right,
linarith, },
end
-- 3ª demostración
example
(h : x^2 = 1)
: x = 1 ∨ x = -1 :=
have h1 : (x - 1) * (x + 1) = 0, from
calc (x - 1) * (x + 1)
= x^2 - 1 : by ring
... = 1 - 1 : by rw h
... = 0 : by ring,
have h2 : x - 1 = 0 ∨ x + 1 = 0,
from mul_eq_zero.mp h1,
or.elim h2
( assume h2a : x - 1 = 0,
have h3 : x = 1,
from sub_eq_zero.mp h2a,
show x = 1 ∨ x = -1,
from or.inl h3)
( assume h2b : x + 1 = 0,
have h4 : x = -1,
from eq_neg_of_add_eq_zero h2b,
show x = 1 ∨ x = -1,
from or.inr h4)
-- 4ª demostración
example
(h : x^2 = 1)
: x = 1 ∨ x = -1 :=
have h1 : (x - 1) * (x + 1) = 0,
by linarith,
have h2 : x - 1 = 0 ∨ x + 1 = 0,
by finish,
or.elim h2
( assume h2a : x - 1 = 0,
have h3 : x = 1,
by linarith,
show x = 1 ∨ x = -1,
from or.inl h3)
( assume h2b : x + 1 = 0,
have h4 : x = -1,
by linarith,
show x = 1 ∨ x = -1,
from or.inr h4)